import { Component, defineAsyncComponent, h } from 'vue';
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
import { MenuDataItem } from './typing';
import Layout from '@/layouts/index.vue';
// import UserLayout from '@/layouts/user-layout.vue';
import UserLayout2 from '@/layouts/user-layout2.vue';
import RouteView from '@/layouts/route-view.vue';
import RouteView1 from '@/layouts/route-view1.vue';
import ls from '@/utils/local-storage';
import { depthEach } from '@/utils/tree';
const AsyncWorkplace = defineAsyncComponent(
  () => import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/workplace/index.vue'),
);
// 菜单路径是否有效
const isAvailablePath = (menus, path) => {
  let has = false;
  depthEach(menus, o => {
    if (o.path === path) has = true;
  });
  return has;
};
// 获取默认页面路径
const getDefaultPage = () => {
  const menus = ls.get('user_menu');
  const confDefaultPage = (window as any).g.defaultPage;
  const availablePath: boolean = isAvailablePath(menus, confDefaultPage);
  const defaultPage = availablePath ? confDefaultPage : menus[0].path;
  return defaultPage;
};
export const routes: MenuDataItem[] = [
  {
    name: 'index',
    path: '/',
    redirect: getDefaultPage,
    component: Layout,
    children: [
      {
        path: '/workplace',
        name: 'Workplace',
        meta: { icon: 'HistoryOutlined', title: 'pages.dashboard.workplace.title', lock: true },
        component: h(RouteView, {}, () => h(AsyncWorkplace)),
      },
      // AI 魔方
      {
        name: 'magicCube',
        path: '/magic-cube',
        meta: { icon: h('i', { class: 'icon-AImofang iconfont' }), title: 'AI魔方' },
        component: RouteView, // RouteView1
        redirect: '/magic-cube/model-list',
        children: [
          {
            name: 'method-mode',
            path: '/magic-cube/method-mode',
            meta: {
              icon: h('i', { class: 'icon-jizhanfamoxingchaoshi iconfont' }),
              title: '技战法模型超市',
            },
            component: RouteView1,
            redirect: '/magic-cube/model-list',
            children: [
              {
                path: '/magic-cube/model-list',
                name: 'model-list',
                meta: { title: '技战法模型总览' },
                component: (): Component =>
                  import('@/views/magic-cube/method-mode/model-list/index.vue'),
              },
              {
                path: '/magic-cube/set-ai-early-warning',
                name: 'set-ai-early-warning',
                meta: { title: '智能预警模型配置' },
                component: (): Component =>
                  import('@/views/magic-cube/method-mode/set-ai-early-warning/index.vue'),
              },
              {
                path: '/magic-cube/set-cg-early-warning',
                name: 'set-cg-early-warning',
                meta: { title: '常规预警模型配置' },
                component: (): Component =>
                  import('@/views/magic-cube/method-mode/set-cg-early-warning/index.vue'),
              },
            ],
          },
          // 标签超市
          {
            name: 'label-supermarket',
            path: '/magic-cube/label-supermarket',
            meta: {
              icon: h('i', { class: 'icon-zidingyibiaoqianchaoshi iconfont' }),
              title: '自定义标签超市',
            },
            component: RouteView1,
            redirect: '/magic-cube/label-supermarket/production',
            children: [
              {
                path: '/magic-cube/label-supermarket/production',
                name: 'label-production',
                meta: { title: '标签生产', hideChildrenInMenu: true },
                component: (): Component =>
                  import(
                    /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/index.vue'
                  ),
                redirect: '/magic-cube/label-supermarket/production/create-ai-label',
                children: [
                  {
                    path: '/magic-cube/label-supermarket/production/create-ai-label',
                    name: 'create-ai-label',
                    meta: { title: '创建AI标签', hideInBreadcrumb: true },
                    component: (): Component =>
                      import(
                        /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-ai-label/index.vue'
                      ),
                    redirect:
                      '/magic-cube/label-supermarket/production/create-ai-label/second-level-ai',
                    children: [
                      {
                        path:
                          '/magic-cube/label-supermarket/production/create-ai-label/second-level-ai',
                        name: 'second-level-ai',
                        meta: {
                          icon: 'HistoryOutlined',
                          title: '创建AI二级标签',
                          hideInBreadcrumb: true,
                        },
                        component: (): Component =>
                          import(
                            /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-ai-label/second-level-ai/index.vue'
                          ),
                      },
                      {
                        path:
                          '/magic-cube/label-supermarket/production/create-ai-label/three-level-ai',
                        name: 'three-level-ai',
                        meta: {
                          icon: 'HistoryOutlined',
                          title: '创建AI三级级标签',
                          hideInBreadcrumb: true,
                        },
                        component: (): Component =>
                          import(
                            /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-ai-label/three-level-ai/index.vue'
                          ),
                      },
                    ],
                  },
                  {
                    path: '/magic-cube/label-supermarket/production/create-custom-label',
                    name: 'create-custom-label',
                    meta: {
                      icon: 'HistoryOutlined',
                      title: '创建自定义标签',
                      hideInBreadcrumb: true,
                    },
                    component: (): Component =>
                      import(
                        /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-custom-label/index.vue'
                      ),
                  },
                  {
                    path: '/magic-cube/label-supermarket/production/create-jq-label',
                    name: 'create-jq-label',
                    meta: {
                      icon: 'HistoryOutlined',
                      title: '创建接警标签',
                      hideInBreadcrumb: true,
                    },
                    component: (): Component =>
                      import(
                        /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-jq-label/index.vue'
                      ),
                  },
                  {
                    path: '/magic-cube/label-supermarket/production/create-fk-label',
                    name: 'create-fk-label',
                    meta: {
                      icon: 'HistoryOutlined',
                      title: '创建反馈标签',
                      hideInBreadcrumb: true,
                    },
                    component: (): Component =>
                      import(
                        /* webpackChunkName: "dashboard" */ '@/views/magic-cube/label-supermarket/production/create-fk-label/index.vue'
                      ),
                  },
                ],
              },
            ],
          },
        ],
      },
      // AI辖区监测
      {
        name: 'districtMonitoring',
        path: '/districtMonitoring',
        meta: { icon: h('i', { class: 'icon-AIxiaqujiance iconfont' }), title: 'AI辖区监测' },
        component: RouteView,
        redirect: '/districtMonitoring/jurisdiction-list',
        children: [
          {
            path: '/districtMonitoring/jurisdiction-list',
            name: 'jurisdictionList',
            meta: { icon: h('i', { class: 'icon-luandianliebiao iconfont' }), title: '乱点列表' },
            component: (): Component =>
              import('@/views/district-monitoring/jurisdiction-list/index.vue'),
          },
          {
            path: '/districtMonitoring/flower-orchard',
            name: 'flowerOrchard',
            meta: { icon: h('i', { class: 'icon-huaguoyuan iconfont' }), title: '花果园' },
            component: (): Component =>
              import('@/views/district-monitoring/flower-orchard/index.vue'),
          },
          {
            path: '/districtMonitoring/address',
            name: 'address',
            meta: { icon: h('i', { class: 'icon-huaguoyuan iconfont' }), title: '地址归一' },
            component: (): Component => import('@/views/district-monitoring/address/index.vue'),
          },
          {
            path: '/districtMonitoring/jurisdiction-details',
            name: 'jurisdictionDetails',
            meta: { title: '乱点详情', hideInMenu: true },
            component: (): Component =>
              import(
                '@/views/district-monitoring/jurisdiction-list/jurisdiction-details/index.vue'
              ),
          },
        ],
      },
      // AI要素赋能
      {
        name: 'studyJudge',
        path: '/studyJudge',
        meta: { icon: h('i', { class: 'icon-AIyaosufuneng iconfont' }), title: 'AI要素赋能' },
        component: RouteView,
        redirect: '/studyJudge/list',
        children: [
          {
            path: '/studyJudge/list',
            name: 'studyJudgeList',
            meta: { icon: h('i', { class: 'icon-yanpanliebiao iconfont' }), title: '研判列表' },
            component: (): Component => import('@/views/study-judge/list/index.vue'),
          },
          {
            path: '/studyJudge/list2',
            name: 'studyJudgeList2',
            meta: { icon: h('i', { class: 'icon-yanpanliebiao iconfont' }), title: '研判列表2' },
            component: (): Component => import('@/views/study-judge/list2/index.vue'),
          },
          {
            path: '/studyJudge/details',
            name: 'studyJudgeDetails',
            meta: { title: '研判详情', hideInMenu: true },
            component: (): Component => import('@/views/study-judge/list/details/index.vue'),
          },
          {
            path: '/studyJudge/details2',
            name: 'studyJudgeDetails2',
            meta: { title: '研判详情', hideInMenu: true },
            component: (): Component => import('@/views/study-judge/list2/details/index.vue'),
          },
          {
            path: '/studyJudge/statistics',
            name: 'studyJudgeStatistics',
            meta: { icon: h('i', { class: 'icon-yanpantongji iconfont' }), title: '研判统计' },
            component: (): Component => import('@/views/study-judge/statistics/index.vue'),
          },
          {
            path: '/studyJudge/force-graph',
            name: 'forceGraph',
            meta: { icon: 'HistoryOutlined', title: '图谱' },
            component: (): Component => import('@/views/study-judge/force-graph/index.vue'),
          },
          {
            name: 'GraphVis',
            path: '/GraphVis',
            meta: { icon: 'HeartOutlined', title: '图谱', hideInMenu: true, keepAlive: false },
            component: (): Component => import('@/views/demo/GraphVis/index.vue'),
          },
          {
            name: 'testIndex',
            path: '/studyJudge/testIndex',
            component: (): Component => import('@/views/study-judge/force-graph/test-index.vue'),
          },
        ],
      },
      // AI专题感知
      {
        name: 'intelligent-analysis',
        path: '/intelligent-analysis',
        meta: { icon: h('i', { class: 'icon-AIzhuantiganzhi iconfont' }), title: 'AI专题感知' },
        component: RouteView,
        redirect: '/alert-list',
        children: [
          {
            path: '/alert-list',
            name: 'alert-list',
            meta: {
              icon: h('i', { class: 'icon-AIzhuantigongzuotai iconfont' }),
              title: '警情列表',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/index.vue'
              ),
          },
          {
            path: '/ai-judgment',
            name: 'ai-judgment',
            meta: {
              icon: h('i', { class: 'icon-AIyanpan iconfont' }),
              title: 'AI研判',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/echarts.vue'
              ),
          },
          {
            path: '/intelligent-factor',
            name: 'intelligent-factor',
            meta: {
              icon: h('i', { class: 'icon-AIqingbaokeli iconfont' }),
              title: '情报颗粒',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/grain.vue'
              ),
          },
          {
            path: '/intelligent-map',
            name: 'intelligent-map',
            meta: {
              icon: h('i', { class: 'icon-ditumoshi iconfont' }),
              title: '地图模式',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/map.vue'
              ),
          },
          {
            path: '/intelligent-check',
            name: 'intelligent-check',
            meta: {
              icon: h('i', { class: 'icon-zhixinduhecha iconfont' }),
              title: '置信度核查 ',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/check.vue'
              ),
          },
          {
            path: '/chartResearch',
            name: 'chartResearch',
            meta: {
              icon: h('i', { class: 'icon-tubiaoyanpan iconfont' }),
              title: '图表研判',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/chart-research.vue'
              ),
          },
          {
            path: '/statistics',
            name: 'statistics',
            meta: { icon: h('i', { class: 'icon-jingqingtongji iconfont' }), title: '警情统计' },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/statistics/index.vue'
              ),
          },
          {
            path: '/statisticsanalysis',
            name: 'statisticsanalysis',
            meta: {
              icon: h('i', { class: 'icon-AIzhuantiyanpantai iconfont' }),
              title: '大屏',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/statisticsanalysis/index.vue'
              ),
          },
          {
            path: '/apiJourney',
            name: 'apiJourney',
            meta: {
              icon: h('i', { class: 'icon-AIzhuantiyanpantai iconfont' }),
              title: '大屏二',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/apiJourney/index.vue'
              ),
          },
          {
            path: '/label',
            name: 'subordinate-label',
            meta: {
              icon: h('i', { class: 'icon-erjibiaoqian iconfont' }),
              title: '二级标签',
              hideInMenu: true,
            },
            component: (): Component =>
              import(
                /* webpackChunkName: "dashboard" */ '@/views/intelligent-analysis/alert-list/label.vue'
              ),
          },
        ],
      },
      //首页
      {
        name: 'home',
        path: '/home',
        meta: {
          icon: h('i', { class: 'icon-changguitongjifenxi iconfont' }),
          title: '常规统计分析',
        },
        component: (): Component => import('@/views/homes/indexs.vue'),
      },
      // 常规统计分析
      {
        name: 'routine-analysis',
        path: '/routine-analysis',
        meta: {
          icon: h('i', { class: 'icon-changguitongjifenxi iconfont' }),
          title: '常规统计分析',
        },
        component: RouteView,
        redirect: '/routine-statistics',
        children: [
          {
            path: '/routine-list',
            name: 'routine-list',
            meta: {
              icon: h('i', { class: 'icon-changguijingqingliebiao iconfont' }),
              title: '警情列表',
            },
            component: (): Component => import('@/views/routine-analysis/list/index.vue'),
          },
          {
            path: '/routine-statistics',
            name: 'routine-statistics',
            meta: {
              icon: h('i', { class: 'icon-changguijingqingtongji iconfont' }),
              title: '警情统计',
            },
            component: (): Component => import('@/views/routine-analysis/statistics/index.vue'),
          },
          {
            path: '/routine-grain',
            name: 'routine-grain',
            meta: {
              icon: h('i', { class: 'icon-changguiqingbaokeli iconfont' }),
              title: '情报颗粒',
              hideInMenu: true,
            },
            component: (): Component => import('@/views/routine-analysis/list/grain.vue'),
          },
          {
            path: '/routine-map',
            name: 'routine-map',
            meta: {
              icon: h('i', { class: 'icon-changguiditumoshi iconfont' }),
              title: '地图模式',
              hideInMenu: true,
            },
            component: (): Component => import('@/views/routine-analysis/list/map.vue'),
          },

          {
            path: '/routine-chartResearch',
            name: 'routine-chartResearch',
            meta: {
              icon: h('i', { class: 'icon-changguitubiaoyanpan iconfont' }),
              title: '图表研判',
              hideInMenu: true,
            },
            component: (): Component => import('@/views/routine-analysis/list/chart-research.vue'),
          },
          {
            path: '/routine-traditionaltopics',
            name: 'routine-traditionaltopics',
            meta: { icon: 'HistoryOutlined', title: '传统专题', hideInMenu: true },
            component: (): Component =>
              import('@/views/routine-analysis/traditionaltopics/index.vue'),
          },
        ],
      },
      // 预警
      {
        name: 'earlyWarning',
        path: '/early-warning',
        meta: { icon: h('i', { class: 'icon-AIyujingzhongxin iconfont' }), title: 'AI预警中心' },
        component: RouteView,
        redirect: '/early-warning/current-alarm',
        children: [
          {
            path: '/early-warning/four-color-warning',
            name: 'fourColorWarning',
            meta: { icon: h('i', { class: 'icon-yujingchaxun iconfont' }), title: '预警查询' },
            component: (): Component =>
              import('@/views/early-warning/four-color-warning/index.vue'),
          },
          {
            path: '/early-warning/four-color-warning/detail',
            name: 'fourColorWarningDetail',
            meta: { title: '预警详情' },
            component: (): Component =>
              import('@/views/early-warning/four-color-warning/detail.vue'),
          },
          {
            path: '/early-warning/current-alarm',
            name: 'currentAlarm',
            meta: { icon: h('i', { class: 'icon-dangqiyujing iconfont' }), title: '当期预警' },
            component: (): Component => import('@/views/early-warning/current-alarm/index.vue'),
          },
          {
            path: '/early-warning/current-alarm/detail',
            name: 'currentAlarmDetail',
            meta: { title: '当期预警详情' },
            component: (): Component => import('@/views/early-warning/current-alarm/detail.vue'),
          },
          {
            path: '/early-warning/festival-warning',
            name: 'festivalWarning',
            meta: { icon: h('i', { class: 'icon-jieriyujing iconfont' }), title: '节日预警' },
            component: (): Component => import('@/views/early-warning/festival-warning/index.vue'),
          },
          {
            path: '/early-warning/location-warning',
            name: 'locationWarning',
            meta: { icon: h('i', { class: 'icon-didianyujing iconfont' }), title: '地点预警' },
            component: (): Component => import('@/views/early-warning/location-warning/index.vue'),
          },
          {
            path: '/early-warning/suspect-warning',
            name: 'suspectWarning',
            meta: { icon: h('i', { class: 'icon-xianyirenyujing iconfont' }), title: '嫌疑人预警' },
            component: (): Component => import('@/views/early-warning/suspect-warning/index.vue'),
          },
          {
            path: '/early-warning/keywords-warning',
            name: 'keywordsWarning',
            meta: {
              icon: h('i', { class: 'icon-guanjianciyujing iconfont' }),
              title: '关键词预警',
            },
            component: (): Component => import('@/views/early-warning/keywords-warning/index.vue'),
          },
          {
            path: '/early-warning/essential-factor-warning',
            name: 'essentialFactorWarning',
            meta: { icon: h('i', { class: 'icon-yaosuyujing iconfont' }), title: '要素预警' },
            component: (): Component =>
              import('@/views/early-warning/essential-factor-warning/index.vue'),
          },
          {
            path: '/early-warning/major-events-warning',
            name: 'majorEventsWarning',
            meta: {
              icon: h('i', { class: 'icon-zhongdashijianyujing iconfont' }),
              title: '重大事件预警',
            },
            component: (): Component =>
              import('@/views/early-warning/major-events-warning/index.vue'),
          },
        ],
      },
      //智能工具箱
      {
        name: 'smartTools',
        path: '/smart-tools',
        meta: { icon: h('i', { class: 'icon-zhinenggongjuxiang iconfont' }), title: '智能工具箱' },
        component: RouteView,
        redirect: '/smart-tools/export',
        children: [
          {
            path: '/smart-tools/export',
            name: 'export',
            meta: { icon: h('i', { class: 'icon-baogaodaochu iconfont' }), title: '分局报告导出' },
            component: (): Component => import('@/views/smart-tools/export/index.vue'),
          },
          {
            path: '/smart-tools/police-station',
            name: 'policeStation',
            meta: {
              icon: h('i', { class: 'icon-baogaodaochu iconfont' }),
              title: '派出所报告导出',
            },
            component: (): Component => import('@/views/smart-tools/export/police-station.vue'),
          },
          {
            path: '/smart-tools/region-history',
            name: 'regionHistory',
            meta: { icon: h('i', { class: 'icon-daochulishi iconfont' }), title: '分局报告历史' },
            component: (): Component =>
              import('@/views/smart-tools/historical-report/region-history.vue'),
          },
          {
            path: '/smart-tools/police-station-history',
            name: 'policeStationHistory',
            meta: { icon: h('i', { class: 'icon-daochulishi iconfont' }), title: '派出所报告历史' },
            component: (): Component =>
              import('@/views/smart-tools/historical-report/police-station-history.vue'),
          },
          {
            path: '/single-initiator/list',
            name: 'singleInitiatorList',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单发起者民警',
            },
            component: (): Component =>
              import('@/views/smart-tools/single-initiator/list/index.vue'),
          },
          {
            path: '/single-examine/list',
            name: 'singleExamineList',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单审批者领导',
            },
            component: (): Component => import('@/views/smart-tools/single-examine/list/index.vue'),
          },
          {
            path: '/single-feedback/list',
            name: 'singleFeedbackList',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单签收和反馈',
            },
            component: (): Component =>
              import('@/views/smart-tools/single-feedback/list/index.vue'),
          },
          {
            path: '/single-statistics/list',
            name: 'singleStatistics',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单统计',
            },
            component: (): Component =>
              import('@/views/smart-tools/single-statistics/list/index.vue'),
          },
          {
            path: '/single-initiator/add',
            name: 'singleInitiatorAdd',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '新建流转单',
            },
            component: (): Component => import('@/views/circulation/add.vue'),
          },
          {
            path: '/single-initiator/detail',
            name: 'singleInitiatorDetail',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单详情',
            },
            component: (): Component => import('@/views/circulation/detail.vue'),
          },
          {
            path: '/single-initiator/feedbackAdd',
            name: 'singleInitiatorfeedbackAdd',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单反馈',
            },
            component: (): Component => import('@/views/circulation/feedbackAdd.vue'),
          },
          {
            path: '/single-initiator/edit',
            name: 'singleInitiatorEdit',
            meta: {
              icon: h('i', { class: 'icon-daochulishi iconfont' }),
              title: '流转单修改',
            },
            component: (): Component => import('@/views/circulation/edit.vue'),
          },
        ],
      },
      // demo
      {
        name: 'demo',
        path: '/demo',
        meta: { icon: 'HeartOutlined', title: 'demo', hideInMenu: true },
        component: (): Component => import('@/views/demo/index.vue'),
      },
      // {
      //     name: 'demo-graph',
      //     path: '/demo-graph',
      //     meta: { icon: 'HeartOutlined', title: 'demo' , hideInMenu: true, },
      //     component: (): Component =>
      //         import('@/views/demo/graph.vue'),
      // },
    ],
  },
];

export const staticRoutes: MenuDataItem[] = [
  //   {
  //     path: '/test',
  //     name: 'test',
  //     meta: { title: 'form.basicform.basic.title' },
  //     component: (): Component =>
  //       import(/* webpackChunkName: "other" */ '@/views/form/basic-form/index.vue'),
  //   },
  {
    path: '/back-stage-management',
    name: 'back-stage-management',
    meta: { title: '' },
    component: () =>
      import(/* webpackChunkName: "user" */ '@/views/user/back-stage-management.vue'),
  },
  {
    path: '/user',
    name: 'user',
    meta: { hideInMenu: true, title: 'pages.layouts.userLayout.title' },
    component: UserLayout2,
    children: [
      {
        path: '/user/login',
        name: 'login',
        meta: { title: 'pages.login.accountLogin.tab' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/login.vue'),
      },

      {
        path: '/user/register',
        name: 'register',
        meta: { title: 'pages.login.registerAccount' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/register.vue'),
      },
      {
        path: '/user/register-result',
        name: 'register-result',
        meta: { title: 'pages.login.registerAccount' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/register-result.vue'),
      },
    ],
  },
  {
    path: '/:pathMatch(.*)',
    component: () => import(/* webpackChunkName: "exception" */ '@/views/exception/404.vue'),
  },
  {
    path: '/default',
    name: 'default',
    meta: { icon: 'HistoryOutlined', title: 'pages.dashboard.workplace.title', lock: true },
    component: (): Component => import(/* webpackChunkName: "dashboard" */ '@/views/default.vue'),
  },
  {
    path: '/preview',
    name: 'preview',
    meta: { title: 'pages.layouts.userLayout.title' },
    component: (): Component => import('@/views/intelligent-analysis/alert-list/preview.vue'),
  },
  {
    path: '/routine-analysis/preview',
    name: 'roPreview',
    meta: { title: 'pages.layouts.userLayout.title' },
    component: (): Component => import('@/views/routine-analysis/statistics/preview.vue'),
  },
];

const routerHistory =
  (window as any).g.routerMode === 'hash'
    ? createWebHashHistory(process.env.VUE_APP_PUBLIC_PATH)
    : createWebHistory(process.env.VUE_APP_PUBLIC_PATH);
const router = createRouter({
  history: routerHistory,
  routes: [...staticRoutes],
  scrollBehavior() {
    // return 期望滚动到哪个的位置
    return { top: 0 };
  },
});

export default router;
